<?php

namespace App\Http\Resources\activity;

use App\Models\activity\ActivityAdmin;
use Illuminate\Http\Resources\Json\ResourceCollection;


class ActivityAdminResource extends ResourceCollection
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request $request
     * @return array
     */
    public function toArray($request)
    {

        return $this->collection->map(function (ActivityAdmin $item) {
            return [
                'user_id' => $item->user_id,
                'user_name' => $item->user->name
            ];
        });
    }
}
